
//
//  JWFindViewController.m
//  jinwang
//
//  Created by jzb on 2018/2/24.
//  Copyright © 2018年 jzb. All rights reserved.
//

#import "JWFindViewController.h"
#import "JWFindVCTableViewCell.h"
#import "BoJianVeiwController.h"
#import "ShopTabBarController.h"
#import "JWFindBusinessActivityVC.h"
#import "JWFindLoactionVC.h"
#import "JWFindBusinessVC.h"
#import "JWFindFreightVC.h"

@interface JWFindViewController ()

@property (nonatomic,strong) UIButton *dingweiBtn;

@property (nonatomic,strong) JWFindVCTableViewCell *cell;


@end

@implementation JWFindViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIBarButtonItem *dingweiItem = [[UIBarButtonItem alloc]initWithCustomView:self.dingweiBtn];
    self.navigationItem.leftBarButtonItem = dingweiItem;
    
    [self setUpTableView];

}

#pragma mark -懒加载
- (UIButton *)dingweiBtn{
    if (!_dingweiBtn) {
        _dingweiBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _dingweiBtn.frame = CGRectMake(0, 0, 44, 44);
        [_dingweiBtn setImage:[UIImage imageNamed:@"jw_find_dingwei"] forState:UIControlStateNormal];
        [_dingweiBtn addTarget:self action:@selector(dingweiButOnclick:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _dingweiBtn;
}


//配置tableView
-(void)setUpTableView{
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.edgesForExtendedLayout = UIRectEdgeNone;
    self.tableView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    //注册cell
    
    [self registerCellWithCellClassArray:@[NSStringFromClass([JWFindVCTableViewCell class])]];
    
}

#pragma mark -UITableViewDelegate,UITableViewDataSource
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    self.cell = [tableView dequeueReusableCellWithIdentifier:[JWFindVCTableViewCell getCellReuseIdentifier]];
    self.cell.contentView.backgroundColor = [UIColor clearColor];
  
    [self.cell.bojianBut addTarget:self action:@selector(cellButtonOnclikc:) forControlEvents:UIControlEventTouchUpInside];
    [self.cell.shopBut addTarget:self action:@selector(cellButtonOnclikc:) forControlEvents:UIControlEventTouchUpInside];
    [self.cell.shopdongtaiBut addTarget:self action:@selector(cellButtonOnclikc:) forControlEvents:UIControlEventTouchUpInside];
    [self.cell.shenbiantianxiaBut addTarget:self action:@selector(cellButtonOnclikc:) forControlEvents:UIControlEventTouchUpInside];
    [self.cell.kuaisushangwuBut addTarget:self action:@selector(cellButtonOnclikc:) forControlEvents:UIControlEventTouchUpInside];
    [self.cell.zhaocheBut addTarget:self action:@selector(cellButtonOnclikc:) forControlEvents:UIControlEventTouchUpInside];
    
    
    return self.cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 360;
}
- (void)cellButtonOnclikc:(UIButton *)sender{
    
    if (sender.tag == 1000) {
        //博见
        BoJianVeiwController *BJVC = [[BoJianVeiwController alloc]init];
        
        [self.navigationController pushViewController:BJVC animated:YES];
    }else if (sender.tag == 1001){
        //商场
        
        ShopTabBarController *tabBarC = [[ShopTabBarController alloc]init];
        
        kKeyWindow.rootViewController = tabBarC;
        
    }else if (sender.tag == 1002){
        //商家动态
        JWFindBusinessActivityVC *BJVC = [[JWFindBusinessActivityVC alloc]init];
        
        [self.navigationController pushViewController:BJVC animated:YES];
    }else if (sender.tag == 1003){
        //身边天下
        JWFindLoactionVC *BJVC = [[JWFindLoactionVC alloc]init];
        [self.navigationController pushViewController:BJVC animated:YES];
        
    }else if (sender.tag == 1004){
        //快急商务
        JWFindBusinessVC *BJVC = [[JWFindBusinessVC alloc]init];
        [self.navigationController pushViewController:BJVC animated:YES];
    }else if (sender.tag == 1005){
        //拼车运货
        JWFindFreightVC *BJVC = [[JWFindFreightVC alloc]init];
        [self.navigationController pushViewController:BJVC animated:YES];
    }
}
- (void)dingweiButOnclick:(UIButton *)sender{
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
